<%@page import="java.util.ArrayList,com.ericsson.mna.model.pojo.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<html>
<head>
<title>View Task</title>
<link rel="stylesheet" type="text/css" href="commonStyle.css">

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.5/css/jquery.dataTables.css">
<script type="text/javascript" type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"></script> 
<script type="text/javascript" type="text/javascript" src="/path/to/jquery.tablesorter.js"></script> 
<script type="text/javascript" type="text/javascript" src ="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {
	
    $('#example').dataTable( {
        "order": [[2 , "desc" ]],
    

	"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
               var a = nRow.innerHTML;
		      // alert(aData[4]);
		
		       if(aData[4] == "Open"){
                      $(nRow).css("color","red"); 
                   }    
		       else if (aData[4] == "Complete")
		    	   {
		    	   $(nRow).css("color","green");
		    	   }

                    return nRow;
                }
    } );
} );
</script>


</head>
<body>
<%@ include file="header.jsp" %>
<div id="nav">

</div>
<form action="taskAction.do" method="post">
<div id="section">
<h3 align="justify" >View Task</h3>
<table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
               <th>Task Id</th>
    <th>Task Name</th>
    <th>Target Date</th>
    <th>Priority</th>
    <th>Status</th>
            </tr>
        </thead>
 
        
 
        <tbody>
  <%ArrayList<Task> taskList=(ArrayList<Task>)request.getAttribute("taskList");
     System.out.println("From ViewTaskJsp" + taskList);
  for(Task t:taskList){%>
  
<tr>
    <td><a href= "taskAction.do?taskId=<%=t.getTask_Id()%>" > <%=t.getTask_Id() %> </a></td>
     <input type="hidden" name="<%=t.getTask_Id()%>" value="<%=t.getTask_Id()%>">
    
    <td><%=t.getTask_Description() %></td>
    <td><%=t.getTask_End_Date() %></td>
    <td><%=t.getPriority() %></td>
    <td><%=t.getStatus() %></td>
  </tr>
 <%} %>
        </tbody>
    </table>
  </div>
  </form>  
<%@ include file="footer.jsp" %>
</body>
</html>
